<?php
namespace Home\Controller;
use Think\Controller;
class UController extends CommonController {
    public function index(){
    	$id = $_GET['id'];

    	$res = M('user')->where(array('id'=>$id))->find();
    	$this->assign('res',$res);
        $this->assign('title',$res['nickname']);

    	$sql = "select * from question  where uid = '$id' order by create_time desc limit 10";

    	$sql = M()->query($sql);

    	$this->assign('sql',$sql);

    	$sql = "select t1.title,t2.content,t2.create_time,t2.qid from question t1 inner join answer t2 on t1.id=t2.qid where t2.uid='$id' limit 10";
    	
    	$arr = M()->query($sql);

    	$this->assign('arr',$arr);

        $this->display();
    }
}